package com.copa.gamestore.module.order.schedule;

import com.copa.gamestore.module.order.application.OrderApplicationService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author copa
 * @createDate 2022-09-29 11:33
 * @function
 */
@Component
public class TimeOutSchedule {

    @Resource
    private OrderApplicationService orderApplicationService;

    /**
     * 按道理说，这种设置并不恰当（这里只是为了演示）
     * 本应该借助于消息队列
     * 集群用Quartz也可以
     */
    // 每一秒执行一次
    @Scheduled(fixedDelay = 1000L)
    public void timeOutOrderCheck() {
        orderApplicationService.timeOutOrderCheck();
    }
}
